//package com.platform.sys.config;
//
//import cn.hutool.core.collection.CollectionUtil;
//import com.alibaba.druid.pool.DruidDataSource;
//import com.alibaba.druid.support.http.StatViewServlet;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.boot.web.servlet.ServletRegistrationBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import com.platform.core.pojo.druid.DruidProperties;
//import org.springframework.context.annotation.Primary;
//
//import java.util.HashMap;
//
///**
// * Druid配置
// */
//@Configuration
//public class DataSourceConfig {
//
//    /* *********************************默认数据配置 start******************************************** */
//    /**
//     * druid属性配置
//     */
//    @Bean
//    @Primary//主数据源
//    @ConfigurationProperties(prefix = "spring.datasource.dynamic.datasource.datasource1")
//    public DruidProperties druidProperties() {
//        return new DruidProperties();
//    }
//
//    /**
//     * druid数据库连接池
//     */
//    @Bean(initMethod = "init")
//    public DruidDataSource dataSource(DruidProperties druidProperties) {
//        DruidDataSource dataSource = new DruidDataSource();
//        druidProperties.config(dataSource);
//        return dataSource;
//    }
//    /* *********************************默认数据配置 end******************************************** */
//
//
//
//    /**
//     * druid监控，配置StatViewServlet
//     * 设置无密码登录
//     */
//    @Bean
//    public ServletRegistrationBean<StatViewServlet> druidServletRegistration() {
//
//        // 设置servlet的参数
//        HashMap<String, String> statViewServletParams = CollectionUtil.newHashMap();
//        statViewServletParams.put("resetEnable", "true");
//        ServletRegistrationBean<StatViewServlet> registration = new ServletRegistrationBean<>(new StatViewServlet());
//        registration.addUrlMappings("/druid/primary/*");
//
//        /* 无密码登录 */
////        statViewServletParams.put("loginUsername", ConstantContextHolder.getDruidLoginConfigs().getLoginUsername());
////        statViewServletParams.put("loginPassword", ConstantContextHolder.getDruidLoginConfigs().getLoginPassword());
//        registration.setInitParameters(statViewServletParams);
//        return registration;
//    }
//
//}
